import 'package:flutter_easyloading/flutter_easyloading.dart';

/// Create： Zhang 3/19/21 5:49 PM
/// 描述：所有弹窗在这里管理

///弹出成功的弹框提示
void toastSuc({String? msg}) async {
  await EasyLoading.showSuccess(msg ?? "成功");
}

///错误弹框
void toastError({String? msg}) async {
  await EasyLoading.showError(msg ?? "失败");
}

///loading框
void toastLoading({String? msg}) async {
  await EasyLoading.show(
    status: msg ?? "正在加载...",
    maskType: EasyLoadingMaskType.clear,
  );
}

///info弹框
void toastInfo({String? msg}) async {
  await EasyLoading.showInfo(msg ?? "提示消息");
}

///toast弹框
void toast(String msg) async {
  await EasyLoading.showToast(
    msg,
    toastPosition: EasyLoadingToastPosition.bottom,
  );
}

///进度提示框
void toastProgress(double progress, {String? msg}) async {
  await EasyLoading.showProgress(
    progress,
    status: msg ?? "正在加载...",
    maskType: EasyLoadingMaskType.clear,
  );
}

///消失弹框
void dismissLoading() async {
  await EasyLoading.dismiss();
}
